package com.zhongke.cotrun.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.zhongke.cotrun.mapper.SignUpInfoMapper;
import com.zhongke.cotrun.model.pojo.SignUpInfo;
import com.zhongke.cotrun.service.SignUpInfoService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service("signUpInfoService")
public class SignUpInfoServiceImpl extends ServiceImpl<SignUpInfoMapper, SignUpInfo> implements SignUpInfoService {

    @Resource
    SignUpInfoMapper signUpInfoMapper;

    @Override
    public PageInfo getSignUpInfo(Integer activitiesId, Integer pageNum, Integer pageSize) {
        PageHelper.startPage(pageNum,pageSize);
        List<SignUpInfo> list = signUpInfoMapper.querySignUpInfo(activitiesId);
        PageInfo info = new PageInfo(list);
        return info;
    }

    @Override
    public PageInfo getSignUpInfoByOrderCode(String orderCode, Integer pageNum, Integer pageSize) {
        PageHelper.startPage(pageNum,pageSize);
        List<SignUpInfo> list = baseMapper.selectList(new QueryWrapper<SignUpInfo>().eq("order_code",orderCode));
        PageInfo info = new PageInfo(list);
        return info;
    }
}
